#ifndef PAGEDOORPARAMETERS_H
#define PAGEDOORPARAMETERS_H

#include <QWidget>
#include <QLabel>
#include <QRegExp>
#include <QRegExpValidator>
#include <QLineEdit>
#include <QKeyEvent>
#include <QTimer>
#include "global_def.h"
#include "numberkeyboarddot.h"

namespace Ui {
class PageDoorParameters;
}

class PageDoorParameters : public QWidget
{
    Q_OBJECT

public:
    explicit PageDoorParameters(QWidget *parent = 0);
    ~PageDoorParameters();
    void setDelOpen(uint16_t delay_time);
    void setDelClose(uint16_t delay_time);
    void setOpenTime(uint16_t time);
    void setCloseTime(uint16_t time);
    void setObstNumb(uint16_t count);
    void setOpenWidthObst(uint16_t width);
    void setSusTimObst(uint16_t time);
    void setFinOpenWidthObst(uint16_t width);
    void setAppTimObst(uint16_t time);
    void setTightClose(uint8_t index, uint16_t force);
    void setPageActive(bool xActive);

    uint16_t getDelOpen() const;
    uint16_t getDelClose() const;
    uint16_t getOpenTime() const;
    uint16_t getCloseTime() const;
    uint16_t getObstNumb() const;
    uint16_t getOpenWidthObst() const;
    uint16_t getSusTimObst() const;
    uint16_t getFinOpenWidthObst() const;
    uint16_t getAppTimObst() const;
    uint16_t getTightClose(uint8_t index) const;
protected:
     bool eventFilter(QObject *obj, QEvent *event);
private slots:
    void on_Btn_Return_clicked();
    void input_slot(int);
    void backspace_slot();
    void cancel_slot();
    void dot_slot();
    void on_Btn_Set_clicked();

signals:
    void returnToMaintMenu();
    void signal_DoorParam(uint8_t);
private:
    Ui::PageDoorParameters *ui;
    NumberKeyBoardDot *m_pNumKeyBoard=nullptr;
    QList<QLineEdit*> inputlist;
    QLineEdit *m_pFocusLinedit=nullptr;
    QList<QLabel*> m_TightCloseList;
private:
    void setRegex();
};

#endif // PAGEDOORPARAMETERS_H
